
<template>
    <div class="layui-row layui-col-space15">
        <% gridList.forEach((item,index) => { %>
            <div class="
            <% if(item.lgNum){ %>
                layui-col-lg<%= item.lgNum %>
            <% } %>
            <% if(item.mdNum){ %>
            layui-col-md<%= item.mdNum %>
            <% } %>
            <% if(item.smNum){ %>
            layui-col-sm<%= item.smNum %>
            <% } %>
            <% if(item.xsNum){ %>
            layui-col-xs<%= item.xsNum %>
            <% } %>">
                <% if(index == 0){ %>
                <!--&&htmlchildren&&-->
                <% } else { %>
                <!--&&htmlchildren<%= index %>&&-->
                <% } %>
            </div>
        <% }); %>
    </div>
</template>
<script name="compile">
    function templateCompile(data) {
        var defaultData = {
            type: "module",
        };
        var newData = Object.assign(defaultData, data);
        var callback = {
            success: true,
            result: newData
        };
        let gridList = [];
        Object.keys(newData).forEach(function(key){
            if(/^children+/.test(key)){
                gridList.push({
                    lgNum: newData[key].lgNum || 12,
                    mdNum: newData[key].mdNum || 12,
                    smNum: newData[key].smNum || 12,
                    xsNum: newData[key].xsNum || 12,
                });
            }
        });
        callback.result.gridList = gridList;
        return callback;
    }
</script>
<script name="templateScript">
    <% gridList.forEach((item, index) => { %>
        <% if (index == 0) { %>
        //&&scriptchildren&&
        <% } else { %>
        //&&scriptchildren<%= index %>&&
        <% } %>
    <% }); %>
</script>